#include <iostream>
#include <cstring>
using namespace std;

void loading(int box[3], int weight[10001], int num, int flag[10001], int count){
	if(count < num){
		int i = count + 1;
		if(flag[i] == 0){
			if(box[1] >= weight[i]){
				box[1] -= weight[i];
				flag[i] = 1;
				loading(box, weight, num, flag, count + 1);
				flag[i] = 0;
				box[1] += weight[i];
			}
			if(box[2] >= weight[i]){
				box[2] -= weight[i];
				flag[i] = 2;
				loading(box, weight, num, flag, count + 1);
				flag[i] = 0;
				box[2] += weight[i];
			}
		}
		return;
	} else{
		for(int i = 1; i <= num; i++)
			cout << flag[i];
		cout << endl;
	}
}

void load(int box[3], int weight[10001], int num){
	int flag[10001];
	memset(flag, 0, sizeof(flag));
	loading(box, weight, num, flag, 0);
}

int main(){
	int box[3];
	int num;
	int weight[10001];
	cin >> box[1] >> box[2] >> num;
	for(int i = 1; i <= num; i++)
		cin >> weight[i];
	load(box, weight, num);
}
